---
image: {{ $.ModuleName }}/{{ $.ImageName }}
fromImage: common/distroless
import:
  - artifact: {{ $.ModuleName }}/{{ $.ImageName }}-artifact
    add: /discoverer
    to: /discoverer
    before: setup
docker:
  ENTRYPOINT: ["/discoverer"]
---
{{ $discovererAbsPath := "/deckhouse/ee/modules/030-cloud-provider-vcd/images/cloud-data-discoverer" }}
{{ $discovererRelPath := printf "%s/modules/030-cloud-provider-vcd/images/cloud-data-discoverer" .ModulePath }}
artifact: {{ .ModuleName }}/{{ .ImageName }}-artifact
from: {{ .Images.BASE_GOLANG_20_ALPINE }}
shell:
  install:
    - cd {{ $discovererAbsPath }}
    - export GOPROXY={{ $.GOPROXY }}
    - go mod download
  setup:
    - cd {{ $discovererAbsPath }}
    - GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags="-s -w" -o /discoverer
    - chown 64535:64535 /discoverer
    - chmod 0755 /discoverer

git:
- add: /{{ $discovererRelPath }}
  to:  {{ $discovererAbsPath }}
  excludePaths:
    - "**/*.md"
    - "**/*.yaml"
    - hack
  stageDependencies:
    install:
      - go.mod
      - go.sum
    setup:
      - "**/*.go"
- add: /go_lib/cloud-data
  to: /deckhouse/go_lib/cloud-data
  excludePaths:
    - "**/*.md"
    - "**/*.yaml"
    - hack
    - {{ $discovererRelPath }}
  stageDependencies:
    install:
      - go.mod
      - go.sum
    setup:
      - "**/*.go"
mount:
  - fromPath: ~/go-pkg-cache
    to: /go/pkg
